Detector architecture v2: static engine, benchmarks, lab, and visual contrast#156
Merged
Conversation
Deploying impeccable with
|
| Latest commit: |
c48b4ab
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://dcee5867.impeccable-2rv.pages.dev |
| Branch Preview URL: | https://codex-detector-v2-speed-visu.impeccable-2rv.pages.dev |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 6b15823. Configure here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
This PR turns the detector work into a much more explicit architecture, with the speed and inspection tooling needed to keep improving it safely.
Detector architecture
cli/engine/detect-antipatterns.mjswhile moving implementation intocli/engine/engines/*,cli/engine/rules/*,cli/engine/shared/*, andcli/engine/browser/injected/*.Static HTML/CSS engine
htmlparser2,css-select,css-tree, anddomutils.@layerflattening, selector matching, specificity/source order,!important, inline styles, variables/fallbacks, inherited typography properties, and needed shorthand expansion.Browser, visual contrast, and extension behavior
createBrowserDetector()for warm browser reuse while keeping one-shotdetectUrl()compatibility.window.impeccableDetect()/window.impeccableDetectAsync()andwindow.impeccableScan()/window.impeccableScanAsync().Benchmarks and detector lab
scripts/benchmark-detector.mjsplusbench:detectorandbench:detector:browserscripts./detectorworkbench for navigating antipattern fixtures, running scans in an iframe, viewing findings, and seeing timing at a glance.Validation
bun run testbun run build:browserbun run build:extensionbun run build:skillsbun run build:sitebun run bench:detector -- --quickbun run bench:detector:browser -- --quickgit diff --checkNotes
Note
Medium Risk
Large change to the browser detector runtime (overlay lifecycle, extension messaging, async scanning, and optional visual contrast sampling) plus new CLI wiring and dependency swaps; main risk is regressions in scan output/perf across environments and new canvas/CORS edge cases.
Overview
Refactors the browser detector build to be generated from a new injected entry (
cli/engine/browser/injected/index.mjs), adding overlay lifecycle management, extension command/error messaging, and new public APIs (impeccableDetect*,impeccableScan*) with optional async scanning.Adds an in-browser visual contrast analyzer that samples computed backgrounds (including images/gradients via canvas when possible), supports offscreen scanning and lazy resolution via
IntersectionObserver, and folds failures intolow-contrastfindings.Introduces a new CLI implementation (
cli/engine/cli/main.mjs) that supports stdin input, URL scanning with optional browser reuse, directory scanning with import-graph context (importedBy), and user prompts/warnings for large scans, and updates dependencies by removingjsdomin favor ofhtmlparser2/css-select/css-tree/domutils.Reviewed by Cursor Bugbot for commit c48b4ab. Bugbot is set up for automated code reviews on this repo. Configure here.